<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
		<meta charset="utf-8" />
	<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">制度通知</a></li>
    <li><a href="#">站内消息</a></li>
   
    </ul>
    </div>
    
    <div class="rightinfo">
    
    <div class="tools">
    <form id="searchForm" class="form-search"
						action="notify/notify_page_list.do" method="post">
    	<ul class="seachform1">
		<li><input name="title" type="text" class="scinput1" value="${title }" placeholder="输入消息标题" /></li>
		<li><input name="" type="button" id="btnSearch" class="scbtn" value="查询"/></li>  
		<div class="clearfix"></div>
		</ul>	
		 <input type="hidden" name="pageNumber" value="1" />
    	</form>
    	<ul class="toolbar">
        <!-- <li class="click"><span><img src="images/t02.png" /></span>修改</li>
        <li><span><img src="images/t03.png" /></span>删除</li>
        <li><span><img src="images/t04.png" /></span>统计</li>
        </ul>
        <ul class="toolbar1">
        <li><span><img src="images/t05.png" /></span>设置</li> -->
        </ul>
  
      </div>
     
     <table class="tablelist">
    	<thead>
    	<tr>
    	<th>发送者</th>
    	<th>接受者</th>
        <th>消息标题</th>
        <th>发送日期</th>
         <th>状态</th>
       <th>操作</th>
      </tr>
        </thead>
        <tbody>
         <c:forEach items="${notifyList}" var="notify"  varStatus="status">
       <tr>
       <td>${notify.fromUserName}</td>
          <td>${notify.toUserName}</td>
        <td>${notify.title}</td>
          <td>${notify.pubTime}</td>
          <td><c:if test="${notify.toUserRead==1}">已阅读</c:if><c:if test="${notify.toUserRead==0}">未阅读</c:if> </td>
		<td><a onclick="check(${notify.id})">查看</a>&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="reply(${notify.id})">回复</a>&nbsp;&nbsp;&nbsp;&nbsp;
		<a onclick="deleteNotify('${notify.id}');">删除</a>
	</td>
      </tr>
      </c:forEach>
        </tbody>
    </table>
   <div class="pagin">
    	<%@ include file="page.jsp"%>
    </div>
    </div>
    <script src="js/jquery-1.7.2.js"></script>
    <script src="layer/layer.js"></script>
    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	$( "#btnSearch" ).on('click', function(e) {
		$("#searchForm").submit();
	});
	function GoToPage(toPage,totalPage) {
	    if(toPage<=0) return;
	    if(toPage>totalPage) return;
	    $("input[name='pageNumber']").val(toPage);
	    $("#searchForm").submit();
	};
	function  check(id) {
		layer.open({
  type: 2,
  closeBtn: 2,
  title: '查看消息',
  shadeClose: true,
  shade: 0.6,
  area: ['530px', '300px'],
  content: 'notify/notify_chcek.do?id='+id,
  end: function () {
      location.reload();
  }
});
	}
	function closeAll() {
		layer.alert('回复成功!', {
			skin : 'layer-ext-moon'
		}, function() {
			layer.closeAll(); 
			 location.reload();
		}); 
	}
	function  reply(id) {
		layer.open({
  type: 2,
  closeBtn: 2,
  title: '回复消息',
  shadeClose: true,
  shade: 0.6,
  area: ['600px', '450px'],
  content:'notify/notify_reply.do?id='+id,
 
});
	}
	function deleteNotify(id) {
		$.ajax({
			type: "GET",
			url: "notify/delete.do?id="+id,
			async: true,
			dataType: "json",
			success: function(data) {
				if("success" == data.result){
					layer.alert('删除成功!', {
			            skin: 'layer-ext-moon' 
					}, function(){
					 location.reload();
					 });
					}else {
						layer.alert('删除失败!', {
				            skin: 'layer-ext-moon' 
				        });
						}
				}
			})
	};
	</script>
</body>

</html>
